home *** CD-ROM | disk | FTP | other *** search
- /*
- * Mac Workstation glue to build exec code with LightSpeedC 4.0
- * The project type must be code resource
- * Check the box for custom header in the project type
- * Created 12:36:21 AM 10/26/89 by Aaron Wohl, aw0g+@andrew.cmu.edu
- * Probably needs LightspeedC 4.0, haven't tried 3.xx
- */
-
- #include "mws.h"
- #include "mws_exec.h"
-
- /*define this to breakpoint on entry for debugging*/
- /* #define DEBUG_EXEC_GLUE */
-
- long mws_a4;
-
- /******* DANGER ********
- * this is where execution begins, not because it is called main
- * but because this is the fist code in the .c file that contains main()
- * so don't add any functions before this one in this file
- */
- void proper_a4()
- {
- asm{
- bra.s @exec_start
- dc.w 0 /*flags word*/
- dc.b 'MWSX' /*type*/
- dc.w 0 /*ID*/
- dc.w 0x5358 /*version*/
- dc.l 0 /*unused*/
- exec_start:
- #ifdef DEBUG_EXEC_GLUE
- _Debugger
- #endif
- move.l a4,a1
- lea main,a4
- move.l a1,mws_a4
- move.l (sp)+,a0 /*return address*/
- move.l (sp)+,d1 /*argument handle*/
- move.w (sp)+,d0 /*tl code*/
- move.l a0,-(sp)
- move.w d0,-(sp)
- move.l d1,-(sp)
- jsr exec_main
- move.w mws_a4,a4
- rts
- #ifdef DEBUG_EXEC_GLUE
- exec_msg:
- dc.b "exec glue entry\000"
- #endif
- }
- }
-
- void CallMWS(void *msg,ProcPtr proc);
- void CallMWS(void *msg,ProcPtr proc)
- {
- asm {
- move.l a4,-(sp) /*save my a4*/
- move.l msg,-(sp)
- move.l proc,a0
- move.l mws_a4,a4
- jsr (a0)
- move.l (sp)+,a4
- };
- }
-
-
- void MWS_Command(TPMsg theMsg,THExecRef execRef)
- {
- CallMWS(theMsg,(*execRef)->xMWSTable[mwsCommand]);
- }
-
- void MWS_Send(TPMsg theMsg,THExecRef execRef)
- {
- CallMWS(theMsg,(*execRef)->xMWSTable[mwsSend]);
- }
-
- void MWS_Receive(TPMsg theMsg,THExecRef execRef)
- {
- CallMWS(theMsg,(*execRef)->xMWSTable[mwsReceive]);
- }
-
- void MWS_GetAlias(TPAlias theMsg,THExecRef execRef)
- {
- CallMWS(((TPMsg)theMsg),(*execRef)->xMWSTable[mwsGetAlias]);
- }
-